<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.15"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>wickr-crypto-c: OpenSSL Crypto Engine</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">wickr-crypto-c
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.15 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">OpenSSL Crypto Engine</div>  </div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:gadfe740d19f9f2096b818553e90dae0d7"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structwickr__buffer.html">wickr_buffer_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__openssl__crypto.html#gadfe740d19f9f2096b818553e90dae0d7">openssl_crypto_random</a> (size_t len)</td></tr>
<tr class="separator:gadfe740d19f9f2096b818553e90dae0d7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga9177055e488f0163d3eb946799df5a67"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structwickr__cipher__key.html">wickr_cipher_key_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__openssl__crypto.html#ga9177055e488f0163d3eb946799df5a67">openssl_cipher_key_random</a> (<a class="el" href="structwickr__cipher.html">wickr_cipher_t</a> cipher)</td></tr>
<tr class="separator:ga9177055e488f0163d3eb946799df5a67"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaf51493d43d3572265abba27e2b3fbc54"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structwickr__cipher__result.html">wickr_cipher_result_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__openssl__crypto.html#gaf51493d43d3572265abba27e2b3fbc54">openssl_aes256_encrypt</a> (const <a class="el" href="structwickr__buffer.html">wickr_buffer_t</a> *plaintext, const <a class="el" href="structwickr__buffer.html">wickr_buffer_t</a> *aad, const <a class="el" href="structwickr__cipher__key.html">wickr_cipher_key_t</a> *key, const <a class="el" href="structwickr__buffer.html">wickr_buffer_t</a> *iv)</td></tr>
<tr class="separator:gaf51493d43d3572265abba27e2b3fbc54"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga75eaf118b28fb76e75579d0a74517b18"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structwickr__buffer.html">wickr_buffer_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__openssl__crypto.html#ga75eaf118b28fb76e75579d0a74517b18">openssl_aes256_decrypt</a> (const <a class="el" href="structwickr__cipher__result.html">wickr_cipher_result_t</a> *cipher_result, const <a class="el" href="structwickr__buffer.html">wickr_buffer_t</a> *aad, const <a class="el" href="structwickr__cipher__key.html">wickr_cipher_key_t</a> *key, bool only_auth_ciphers)</td></tr>
<tr class="separator:ga75eaf118b28fb76e75579d0a74517b18"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga19991a9b00d0c383c64935fa2acecda7"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structwickr__buffer.html">wickr_buffer_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__openssl__crypto.html#ga19991a9b00d0c383c64935fa2acecda7">openssl_sha2</a> (const <a class="el" href="structwickr__buffer.html">wickr_buffer_t</a> *buffer, const <a class="el" href="structwickr__buffer.html">wickr_buffer_t</a> *salt, <a class="el" href="structwickr__digest.html">wickr_digest_t</a> mode)</td></tr>
<tr class="separator:ga19991a9b00d0c383c64935fa2acecda7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga75a01a740d558bfcc0f10920266cd9d5"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structwickr__ec__key.html">wickr_ec_key_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__openssl__crypto.html#ga75a01a740d558bfcc0f10920266cd9d5">openssl_ec_rand_key</a> (<a class="el" href="structwickr__ec__curve.html">wickr_ec_curve_t</a> curve)</td></tr>
<tr class="separator:ga75a01a740d558bfcc0f10920266cd9d5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gab2cc137ada900eba89796857603cd8cd"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structwickr__ec__key.html">wickr_ec_key_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__openssl__crypto.html#gab2cc137ada900eba89796857603cd8cd">openssl_ec_key_import</a> (const <a class="el" href="structwickr__buffer.html">wickr_buffer_t</a> *buffer, bool is_private)</td></tr>
<tr class="separator:gab2cc137ada900eba89796857603cd8cd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gab32cef5c789ee1992afae98a81b65823"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structwickr__ecdsa__result.html">wickr_ecdsa_result_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__openssl__crypto.html#gab32cef5c789ee1992afae98a81b65823">openssl_ec_sign</a> (const <a class="el" href="structwickr__ec__key.html">wickr_ec_key_t</a> *ec_signing_key, const <a class="el" href="structwickr__buffer.html">wickr_buffer_t</a> *data_to_sign, <a class="el" href="structwickr__digest.html">wickr_digest_t</a> digest_mode)</td></tr>
<tr class="separator:gab32cef5c789ee1992afae98a81b65823"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga1e2b3f17c67e97360b616d0d673767f7"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__openssl__crypto.html#ga1e2b3f17c67e97360b616d0d673767f7">openssl_ec_verify</a> (const <a class="el" href="structwickr__ecdsa__result.html">wickr_ecdsa_result_t</a> *signature, const <a class="el" href="structwickr__ec__key.html">wickr_ec_key_t</a> *ec_public_key, const <a class="el" href="structwickr__buffer.html">wickr_buffer_t</a> *data_to_verify)</td></tr>
<tr class="separator:ga1e2b3f17c67e97360b616d0d673767f7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gac18a3e234621caaabf695715fb22d950"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structwickr__buffer.html">wickr_buffer_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__openssl__crypto.html#gac18a3e234621caaabf695715fb22d950">openssl_gen_shared_secret</a> (const <a class="el" href="structwickr__ec__key.html">wickr_ec_key_t</a> *local, const <a class="el" href="structwickr__ec__key.html">wickr_ec_key_t</a> *peer)</td></tr>
<tr class="separator:gac18a3e234621caaabf695715fb22d950"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaeb4574976214a17eb79bbc3d76f573a6"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structwickr__buffer.html">wickr_buffer_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__openssl__crypto.html#gaeb4574976214a17eb79bbc3d76f573a6">openssl_hmac_create</a> (const <a class="el" href="structwickr__buffer.html">wickr_buffer_t</a> *data, const <a class="el" href="structwickr__buffer.html">wickr_buffer_t</a> *hmac_key, <a class="el" href="structwickr__digest.html">wickr_digest_t</a> mode)</td></tr>
<tr class="separator:gaeb4574976214a17eb79bbc3d76f573a6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gafbde176ef6f2b99ff9dab58ad69a9a74"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__openssl__crypto.html#gafbde176ef6f2b99ff9dab58ad69a9a74">openssl_hmac_verify</a> (const <a class="el" href="structwickr__buffer.html">wickr_buffer_t</a> *data, const <a class="el" href="structwickr__buffer.html">wickr_buffer_t</a> *hmac_key, <a class="el" href="structwickr__digest.html">wickr_digest_t</a> mode, const <a class="el" href="structwickr__buffer.html">wickr_buffer_t</a> *expected)</td></tr>
<tr class="separator:gafbde176ef6f2b99ff9dab58ad69a9a74"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga788a03002d8c6048401cf0bbc2d48c7a"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structwickr__buffer.html">wickr_buffer_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__openssl__crypto.html#ga788a03002d8c6048401cf0bbc2d48c7a">openssl_hkdf</a> (const <a class="el" href="structwickr__buffer.html">wickr_buffer_t</a> *input_key_material, const <a class="el" href="structwickr__buffer.html">wickr_buffer_t</a> *salt, const <a class="el" href="structwickr__buffer.html">wickr_buffer_t</a> *info, <a class="el" href="structwickr__digest.html">wickr_digest_t</a> hash_mode)</td></tr>
<tr class="separator:ga788a03002d8c6048401cf0bbc2d48c7a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga12da75115315fbf7394f4791a2eb815c"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structwickr__buffer.html">wickr_buffer_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__openssl__crypto.html#ga12da75115315fbf7394f4791a2eb815c">openssl_sha2_file</a> (FILE *in_file, <a class="el" href="structwickr__digest.html">wickr_digest_t</a> mode)</td></tr>
<tr class="separator:ga12da75115315fbf7394f4791a2eb815c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga178fa1f33ad2767c27411c3ebcdd3ca0"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__openssl__crypto.html#ga178fa1f33ad2767c27411c3ebcdd3ca0">openssl_encrypt_file</a> (FILE *in_file, const <a class="el" href="structwickr__cipher__key.html">wickr_cipher_key_t</a> *key, FILE *out_file)</td></tr>
<tr class="separator:ga178fa1f33ad2767c27411c3ebcdd3ca0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaf1faa509e06c188acfbdf43e2197c61a"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__openssl__crypto.html#gaf1faa509e06c188acfbdf43e2197c61a">openssl_decrypt_file</a> (FILE *in_file, const <a class="el" href="structwickr__cipher__key.html">wickr_cipher_key_t</a> *key, FILE *out_file, bool only_auth_ciphers)</td></tr>
<tr class="separator:gaf1faa509e06c188acfbdf43e2197c61a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga04773a29991559a4004c23cc4e8badd7"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__openssl__crypto.html#ga04773a29991559a4004c23cc4e8badd7">openssl_enable_fips_mode</a> (void)</td></tr>
<tr class="separator:ga04773a29991559a4004c23cc4e8badd7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaed92eb2b892df254af6099cd472b027a"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__openssl__crypto.html#gaed92eb2b892df254af6099cd472b027a">openssl_is_fips_supported</a> ()</td></tr>
<tr class="separator:gaed92eb2b892df254af6099cd472b027a"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<h2 class="groupheader">Function Documentation</h2>
<a id="ga75eaf118b28fb76e75579d0a74517b18"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga75eaf118b28fb76e75579d0a74517b18">&#9670;&nbsp;</a></span>openssl_aes256_decrypt()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structwickr__buffer.html">wickr_buffer_t</a>* openssl_aes256_decrypt </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structwickr__cipher__result.html">wickr_cipher_result_t</a> *&#160;</td>
          <td class="paramname"><em>cipher_result</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structwickr__buffer.html">wickr_buffer_t</a> *&#160;</td>
          <td class="paramname"><em>aad</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structwickr__cipher__key.html">wickr_cipher_key_t</a> *&#160;</td>
          <td class="paramname"><em>key</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>only_auth_ciphers</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Decrypt a cipher_result using AES256 Currently supports AES256-GCM and AES256-CTR cipher modes</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">cipher_result</td><td>a cipher result generated from 'openssl_aes256_encrypt' </td></tr>
    <tr><td class="paramname">aad</td><td>additional data to authenticate with the ciphertext (only works with authenticated ciphers) </td></tr>
    <tr><td class="paramname">key</td><td>the key to use to attempt to decrypt 'cipher_result' </td></tr>
    <tr><td class="paramname">only_auth_ciphers</td><td>if true, only authenticated ciphers may be used for decryption </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a buffer containing decrypted bytes. If the AES mode is authenticated, NULL will be returned if key is incorrect. </dd></dl>

</div>
</div>
<a id="gaf51493d43d3572265abba27e2b3fbc54"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaf51493d43d3572265abba27e2b3fbc54">&#9670;&nbsp;</a></span>openssl_aes256_encrypt()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structwickr__cipher__result.html">wickr_cipher_result_t</a>* openssl_aes256_encrypt </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structwickr__buffer.html">wickr_buffer_t</a> *&#160;</td>
          <td class="paramname"><em>plaintext</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structwickr__buffer.html">wickr_buffer_t</a> *&#160;</td>
          <td class="paramname"><em>aad</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structwickr__cipher__key.html">wickr_cipher_key_t</a> *&#160;</td>
          <td class="paramname"><em>key</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structwickr__buffer.html">wickr_buffer_t</a> *&#160;</td>
          <td class="paramname"><em>iv</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Encrypt a buffer using AES256 Currently supports AES256-GCM and AES256-CTR cipher modes</p>
<p>NOTE: IV is randomly chosen using 'openssl_crypto_random' if one is not provided</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">plaintext</td><td>the content to encrypt using 'key' </td></tr>
    <tr><td class="paramname">aad</td><td>additional data to authenticate with the ciphertext (only works with authenticated ciphers) </td></tr>
    <tr><td class="paramname">key</td><td>the cipher key to use to encrypt 'plaintext' </td></tr>
    <tr><td class="paramname">iv</td><td>an initialization vector to use with the cipher mode, or NULL if one should be chosen at random </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a cipher result containing encrypted bytes, or NULL if the cipher mode fails or is not supported </dd></dl>

</div>
</div>
<a id="ga9177055e488f0163d3eb946799df5a67"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga9177055e488f0163d3eb946799df5a67">&#9670;&nbsp;</a></span>openssl_cipher_key_random()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structwickr__cipher__key.html">wickr_cipher_key_t</a>* openssl_cipher_key_random </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structwickr__cipher.html">wickr_cipher_t</a>&#160;</td>
          <td class="paramname"><em>cipher</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Generate a secure random cipher key for a particular cipher Currently supports AES256-GCM and AES256-CTR cipher modes</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">cipher</td><td>the cipher to generate a random key for </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a cipher key containing key material generated by 'openssl_crypto_random' or NULL if random byte generation fails </dd></dl>

</div>
</div>
<a id="gadfe740d19f9f2096b818553e90dae0d7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gadfe740d19f9f2096b818553e90dae0d7">&#9670;&nbsp;</a></span>openssl_crypto_random()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structwickr__buffer.html">wickr_buffer_t</a>* openssl_crypto_random </td>
          <td>(</td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>len</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Generate secure random bytes using the rand_bytes function from OpenSSL</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">len</td><td>the number of bytes to generate </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a buffer containing 'len' secure random bytes or NULL if random byte generation fails </dd></dl>

</div>
</div>
<a id="gaf1faa509e06c188acfbdf43e2197c61a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaf1faa509e06c188acfbdf43e2197c61a">&#9670;&nbsp;</a></span>openssl_decrypt_file()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool openssl_decrypt_file </td>
          <td>(</td>
          <td class="paramtype">FILE *&#160;</td>
          <td class="paramname"><em>in_file</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structwickr__cipher__key.html">wickr_cipher_key_t</a> *&#160;</td>
          <td class="paramname"><em>key</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">FILE *&#160;</td>
          <td class="paramname"><em>out_file</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>only_auth_ciphers</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Decrypt a file with AES256</p>
<p>Note: Unauthenticated modes will always succeed and the contents of 'out_file' may be incorrect For this reason it is useful to use an authenticated mode such as AES256 GCM when encrypting files</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">in_file</td><td>the encrypted file to decrypt </td></tr>
    <tr><td class="paramname">key</td><td>the key to use for decryption </td></tr>
    <tr><td class="paramname">out_file</td><td>the file to write the decrypted data from 'in_file' </td></tr>
    <tr><td class="paramname">only_auth_ciphers</td><td>if true, only authenticated ciphers may be used for decryption </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true if the decryption operation succeeds, and 'out_file' can be written </dd></dl>

</div>
</div>
<a id="gab2cc137ada900eba89796857603cd8cd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gab2cc137ada900eba89796857603cd8cd">&#9670;&nbsp;</a></span>openssl_ec_key_import()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structwickr__ec__key.html">wickr_ec_key_t</a>* openssl_ec_key_import </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structwickr__buffer.html">wickr_buffer_t</a> *&#160;</td>
          <td class="paramname"><em>buffer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>is_private</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Import an Elliptic Curve key from a buffer</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">buffer</td><td>the buffer representing Elliptic Curve key material </td></tr>
    <tr><td class="paramname">is_private</td><td>false if the buffer represents a public key </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>an Elliptic Curve key pair parsed from buffer or NULL if buffer does not contain a valid key, or is_private is incorrectly set </dd></dl>

</div>
</div>
<a id="ga75a01a740d558bfcc0f10920266cd9d5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga75a01a740d558bfcc0f10920266cd9d5">&#9670;&nbsp;</a></span>openssl_ec_rand_key()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structwickr__ec__key.html">wickr_ec_key_t</a>* openssl_ec_rand_key </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structwickr__ec__curve.html">wickr_ec_curve_t</a>&#160;</td>
          <td class="paramname"><em>curve</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Generate a random Elliptic Curve keypair Supported curve is currently limited to NIST P521</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">curve</td><td>the curve parameters to use for random key pair generation </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a random Elliptic Curve key pair or NULL if the random generation fails </dd></dl>

</div>
</div>
<a id="gab32cef5c789ee1992afae98a81b65823"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gab32cef5c789ee1992afae98a81b65823">&#9670;&nbsp;</a></span>openssl_ec_sign()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structwickr__ecdsa__result.html">wickr_ecdsa_result_t</a>* openssl_ec_sign </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structwickr__ec__key.html">wickr_ec_key_t</a> *&#160;</td>
          <td class="paramname"><em>ec_signing_key</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structwickr__buffer.html">wickr_buffer_t</a> *&#160;</td>
          <td class="paramname"><em>data_to_sign</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structwickr__digest.html">wickr_digest_t</a>&#160;</td>
          <td class="paramname"><em>digest_mode</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Sign data using an Elliptic Curve key Data is hashed before signing. This function will calculate ECDSA(SHA2(data_to_sign))</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">ec_signing_key</td><td>private signing key to use for the ECDSA algorithm </td></tr>
    <tr><td class="paramname">data_to_sign</td><td>the data to hash with 'digest_mode', and then sign with 'ec_signing_key' </td></tr>
    <tr><td class="paramname">digest_mode</td><td>the digest mode to use for SHA2 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>an ecdsa result containing the output of ECDSA(SHA2(data_to_sign)) or NULL if the 'ec_signing_key' is not a private key </dd></dl>

</div>
</div>
<a id="ga1e2b3f17c67e97360b616d0d673767f7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga1e2b3f17c67e97360b616d0d673767f7">&#9670;&nbsp;</a></span>openssl_ec_verify()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool openssl_ec_verify </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structwickr__ecdsa__result.html">wickr_ecdsa_result_t</a> *&#160;</td>
          <td class="paramname"><em>signature</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structwickr__ec__key.html">wickr_ec_key_t</a> *&#160;</td>
          <td class="paramname"><em>ec_public_key</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structwickr__buffer.html">wickr_buffer_t</a> *&#160;</td>
          <td class="paramname"><em>data_to_verify</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Verify ECDSA signatures</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">signature</td><td>a signature produced with 'openssl_ec_sign' </td></tr>
    <tr><td class="paramname">ec_public_key</td><td>the public signing key to use for verification </td></tr>
    <tr><td class="paramname">data_to_verify</td><td>the original data that should have been signed with 'ec_public_key'. It will be hashed inside this function as part of the verification process </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true if 'signature' can be verified by 'ec_public_key' </dd></dl>

</div>
</div>
<a id="ga04773a29991559a4004c23cc4e8badd7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga04773a29991559a4004c23cc4e8badd7">&#9670;&nbsp;</a></span>openssl_enable_fips_mode()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool openssl_enable_fips_mode </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Enable FIPS mode</p>
<dl class="section return"><dt>Returns</dt><dd>true if openssl fips enable is allowed </dd></dl>

</div>
</div>
<a id="ga178fa1f33ad2767c27411c3ebcdd3ca0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga178fa1f33ad2767c27411c3ebcdd3ca0">&#9670;&nbsp;</a></span>openssl_encrypt_file()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool openssl_encrypt_file </td>
          <td>(</td>
          <td class="paramtype">FILE *&#160;</td>
          <td class="paramname"><em>in_file</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structwickr__cipher__key.html">wickr_cipher_key_t</a> *&#160;</td>
          <td class="paramname"><em>key</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">FILE *&#160;</td>
          <td class="paramname"><em>out_file</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Encrypt a file with AES256</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">in_file</td><td>the file to encrypt </td></tr>
    <tr><td class="paramname">key</td><td>the key to use for AES256 </td></tr>
    <tr><td class="paramname">out_file</td><td>a file that should contain the encrypted data </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true if encryption succeeds, and 'out_file' can be written </dd></dl>

</div>
</div>
<a id="gac18a3e234621caaabf695715fb22d950"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gac18a3e234621caaabf695715fb22d950">&#9670;&nbsp;</a></span>openssl_gen_shared_secret()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structwickr__buffer.html">wickr_buffer_t</a>* openssl_gen_shared_secret </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structwickr__ec__key.html">wickr_ec_key_t</a> *&#160;</td>
          <td class="paramname"><em>local</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structwickr__ec__key.html">wickr_ec_key_t</a> *&#160;</td>
          <td class="paramname"><em>peer</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Generate a shared secret given Elliptic Curve Diffie-Hellman parameters</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">local</td><td>the local elliptic curve private key </td></tr>
    <tr><td class="paramname">peer</td><td>the remote elliptic curve public key </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a buffer containing the shared secret computed with 'local' private key and 'peer' public key </dd></dl>

</div>
</div>
<a id="ga788a03002d8c6048401cf0bbc2d48c7a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga788a03002d8c6048401cf0bbc2d48c7a">&#9670;&nbsp;</a></span>openssl_hkdf()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structwickr__buffer.html">wickr_buffer_t</a>* openssl_hkdf </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structwickr__buffer.html">wickr_buffer_t</a> *&#160;</td>
          <td class="paramname"><em>input_key_material</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structwickr__buffer.html">wickr_buffer_t</a> *&#160;</td>
          <td class="paramname"><em>salt</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structwickr__buffer.html">wickr_buffer_t</a> *&#160;</td>
          <td class="paramname"><em>info</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structwickr__digest.html">wickr_digest_t</a>&#160;</td>
          <td class="paramname"><em>hash_mode</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Derive a key with HMAC Key Derivation Function</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">input_key_material</td><td>the original key to extract and expand using HKDF </td></tr>
    <tr><td class="paramname">salt</td><td>a salt value to provide to HKDF, this should be randomly generated or NULL if no salt should be used </td></tr>
    <tr><td class="paramname">info</td><td>contextual information to pass to HKDF, this can be NULL if no contextual information should be used </td></tr>
    <tr><td class="paramname">hash_mode</td><td>the hash mode to use for the HKDF output, this will determine the length of the final output </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a buffer containing the calculated HKDF value </dd></dl>

</div>
</div>
<a id="gaeb4574976214a17eb79bbc3d76f573a6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaeb4574976214a17eb79bbc3d76f573a6">&#9670;&nbsp;</a></span>openssl_hmac_create()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structwickr__buffer.html">wickr_buffer_t</a>* openssl_hmac_create </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structwickr__buffer.html">wickr_buffer_t</a> *&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structwickr__buffer.html">wickr_buffer_t</a> *&#160;</td>
          <td class="paramname"><em>hmac_key</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structwickr__digest.html">wickr_digest_t</a>&#160;</td>
          <td class="paramname"><em>mode</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Generate an HMAC</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">data</td><td>the data to take the HMAC of </td></tr>
    <tr><td class="paramname">hmac_key</td><td>a key to use for HMAC </td></tr>
    <tr><td class="paramname">mode</td><td>the digest mode to perform HMAC with. This will determine the length of the output </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a buffer containing the HMAC of 'data' with 'hmac_key' </dd></dl>

</div>
</div>
<a id="gafbde176ef6f2b99ff9dab58ad69a9a74"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gafbde176ef6f2b99ff9dab58ad69a9a74">&#9670;&nbsp;</a></span>openssl_hmac_verify()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool openssl_hmac_verify </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structwickr__buffer.html">wickr_buffer_t</a> *&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structwickr__buffer.html">wickr_buffer_t</a> *&#160;</td>
          <td class="paramname"><em>hmac_key</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structwickr__digest.html">wickr_digest_t</a>&#160;</td>
          <td class="paramname"><em>mode</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structwickr__buffer.html">wickr_buffer_t</a> *&#160;</td>
          <td class="paramname"><em>expected</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Verify an HMAC against an expected result</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">data</td><td>the data to calculate the expected HMAC with </td></tr>
    <tr><td class="paramname">hmac_key</td><td>the key to use along with 'data' to create the expected HMAC with </td></tr>
    <tr><td class="paramname">mode</td><td>the mode to use for generating the expected HMAC </td></tr>
    <tr><td class="paramname">expected</td><td>the value to compare the generated HMAC with </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true if 'expected' is equal to the HMAC of 'data' and 'hmac_key' </dd></dl>

</div>
</div>
<a id="gaed92eb2b892df254af6099cd472b027a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaed92eb2b892df254af6099cd472b027a">&#9670;&nbsp;</a></span>openssl_is_fips_supported()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool openssl_is_fips_supported </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Determine if FIPS mode is available</p>
<dl class="section return"><dt>Returns</dt><dd>true if openssl fips mode is available </dd></dl>

</div>
</div>
<a id="ga19991a9b00d0c383c64935fa2acecda7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga19991a9b00d0c383c64935fa2acecda7">&#9670;&nbsp;</a></span>openssl_sha2()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structwickr__buffer.html">wickr_buffer_t</a>* openssl_sha2 </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structwickr__buffer.html">wickr_buffer_t</a> *&#160;</td>
          <td class="paramname"><em>buffer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structwickr__buffer.html">wickr_buffer_t</a> *&#160;</td>
          <td class="paramname"><em>salt</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structwickr__digest.html">wickr_digest_t</a>&#160;</td>
          <td class="paramname"><em>mode</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Calculate a SHA2 hash of a buffer using an optional salt value Supported modes of SHA2 are SHA256, SHA384 and SHA512</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">buffer</td><td>the buffer to hash </td></tr>
    <tr><td class="paramname">salt</td><td>a salt value to concatenate to buffer before taking the hash. The input to the SHA2 function will be SHA2(buffer || salt) Passing NULL will allow for no salt to be used </td></tr>
    <tr><td class="paramname">mode</td><td>the mode of SHA2 to use for hashing </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a buffer containing the derived hash or NULL if the hashing operation fails </dd></dl>

</div>
</div>
<a id="ga12da75115315fbf7394f4791a2eb815c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga12da75115315fbf7394f4791a2eb815c">&#9670;&nbsp;</a></span>openssl_sha2_file()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structwickr__buffer.html">wickr_buffer_t</a>* openssl_sha2_file </td>
          <td>(</td>
          <td class="paramtype">FILE *&#160;</td>
          <td class="paramname"><em>in_file</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structwickr__digest.html">wickr_digest_t</a>&#160;</td>
          <td class="paramname"><em>mode</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Calculate the SHA2 hash of a file</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">in_file</td><td>a file to take the hash of it's contents </td></tr>
    <tr><td class="paramname">mode</td><td>the mode to use for calculating the hash </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a buffer containing the output of the chosen SHA2 mode of the contents of in_file </dd></dl>

</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.15
</small></address>
</body>
</html>
